package org.offsync.nio

import java.nio.channels.SelectableChannel
import java.nio.channels.SelectionKey
import java.nio.channels.Selector
import java.nio.channels.spi.SelectorProvider

case class NioSelectableChannel(
    protected val channel: SelectableChannel) {
  def blockingLock: Object = channel.blockingLock
  
  def configureBlocking(block: Boolean): SelectableChannel = channel.configureBlocking(block)
  
  def isBlocking: Boolean = channel.isBlocking
  
  def isRegistered: Boolean = channel.isRegistered
  
  def keyFor(selector: NioOpSelector): SelectionKey = channel.keyFor(selector.selector)
  
  def provider: SelectorProvider = channel.provider
  
  def register(selector: NioOpSelector): SelectionKey = channel.register(selector.selector, selector.op)
  
  def register(selector: NioOpSelector, attachment: Object): SelectionKey = channel.register(selector.selector, selector.op, attachment)
  
  def validOps: Int = channel.validOps
}
